package TEST;

import java.util.Arrays;
import java.util.Scanner;

public class Test4 {
    public static void main(String[] args) {
        String m = "我爱你中国，我爱你故乡";
        System.out.println(m);
        Scanner input = new Scanner(System.in);
        System.out.println("请输入你要查找的字符：");
        String n = input.next();
        String[] s = m.split(""); //拆分，用什么来拆分
        System.out.println(Arrays.toString(s));
        int index=0;
        for (String s1 : s) {
            if(s1.equals(n)){
                index++;
            }
        }
        System.out.println(n+"出现了"+index+"次");

    }
}
